import History from './base.js';

export default class HashHistory extends History {
    constructor (router) {
        super(router);
    }
    getCurrentLocation () {
        return getHash();
    }
    setupListener () {
        window.addEventListener('hashchange', () => {
            this.transitionTo(getHash());
        });
    }
};

function getHash () {
    return window.location.hash.slice(1);
}